import 'package:flutter/material.dart';
import 'myrenderbox.dart';

class MyApp extends StatefulWidget {
  const MyApp({super.key});
  @override
  State<MyApp> createState() => _MyAPPState();
}

class _MyAPPState extends State<MyApp> {
  double _scale = 1.0;
  double _offsetX = 0.0;
  double _offsetY = 0.0;

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onScaleUpdate: (details) {
        setState(() {
          _scale = details.scale;
          _offsetX = details.localFocalPoint.dx;
          _offsetY = details.localFocalPoint.dy;
        });
      },
      child: Transform(
        transform: Matrix4.identity()
          ..translate(_offsetX, _offsetY)
          ..scale(_scale),
        child: MyRenderBoxWidget(),
      ),
    );
  }
}

void main() {
  runApp(MyApp());
}
